package com.yupi.springbootinit.bizmq;

import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * @TODO 生产者
 */
@Component
public class BiMessageProducer {

    @Resource
    private RabbitTemplate rabbitTemplate;

    /**
     * 发送消息给 消息队列
     * @param message 消息为用户id
     */
    public void sendMessage(String message) {
        rabbitTemplate.convertAndSend(BiMqConstant.BI_EXCHANGE_NAME, BiMqConstant.BI_ROUTING_KEY, message);
    }

    /**
     * 发送消息给 消息队列
     * @param message 消息为用户id
     */
    public void sendMessageByWenxin(String message) {
        rabbitTemplate.convertAndSend(BiMqConstant.WENXIN_EXCHANGE_NAME, BiMqConstant.WENXIN_ROUTING_KEY, message);
    }
}
